
<?php
session_start();
require_once '../models/Product.php';
$productID= $_REQUEST['productID'];
$rows	= Product::getInfoProduct_($productID);
?>
<!DOCTYPE html>
<html>
<head>
<title>Update Product</title>
<?php include '../admin/_meta.php';?>
	<script type="text/javascript" src="../js/jquery.7.1.min.js"></script>
	<script type="text/javascript" src="../js/jquery.form.js"></script>
	<script type="text/javascript" src="../js/script.js"></script>
</head>
<body>
	<div id="firstLine">
		<div id="top-bar">
		<?php include '_top_bar_admin.php';?>
		</div>
	</div>
	<div id="container">
		<div id="header">
			<?php include '_menu_admin.php';?>
		</div>
		<div id="center">
			<div id="table-user">
				<table id="table-admin">
					<tr>
						<td colspan="2"><b>Update Product</b></td>
					</tr>
					<tr>
						<td>Product ID</td>
						<td><input type="text" name="productID" id="productID" value="<?php echo $rows["productID"];?>" disabled="disabled"></td>
					</tr>
						<td>Brand Name:</td>
						<td><select id="brandID" name="brandID" onchange="printModelDrop();">"
								<?php Product::printBrandDrop($rows['brandID']);?></select></td>
					<tr>
					<tr>
						<td>Model Name:</td>
						<td><div class="drop-container" id="model-drop-container">
						<select id="modelID" name="modelID" class="dropbox" onchange="printSeriesDrop();">
							
							<?php Product::printModelDrop2($rows['brandID'],$rows['modelID']);?>
						</select>
						</div></td>
					<tr>
					<tr>
						<td>Series Name:</td>
						<td><div id="series-drop-container" class="drop-container">
						<select id="seriesID" name="seriesID" class="dropbox">
							<?php Product::printSeriesDrop2($rows['modelID'],$rows['seriesID']);?>
						</div></td>
					</tr>
						<!-- loader.gif -->
					<img style="display:none" id="loader" src="../images/loader.gif" alt="Loading...." title="Loading...." />
						<td>Image:</td>
						<td><div class="wrap">
						<!-- simple file uploading form -->
						<form id="form" action="../models/ajaxupload.php" method="post" enctype="multipart/form-data">
							<input id="uploadImage" type="file" accept="image/*" name="image" />
							<input id="button" type="submit" value="Upload">
						</form>
						
							
						<!-- preview action or error msgs -->
						<div id="preview" >
							<div class="img_small_wrap"><img name='uploadImage2' id='image' src='<?php echo $rows['image']?>'class="img_small"/></div>
							<input type='hidden' name='uploadImage2' id='uploadImage2' value='<?php echo $rows['image']?>' />
						</div>
						</div><!--wrap--></td>
					</tr>
					<tr>
						<td>Quantity:</td>
						<td><input type="text" name="quantity" id="quantity" value="<?php echo $rows["quantity"]?>" /></td>
					</tr>
					<tr>
						<td>Price:</td>
						<td><input type="text" name="price" id="price" value="<?php echo $rows["price"]?>" /></td>
					</tr>
					<tr>
						<td>Status:</td>
						<td><select name="status_pr" id="status_pr">
						<?php if($rows['status_pr']=="active"){
						echo "<option value='active'>Active</option>";
						echo "<option value='block'>Block</option>";
						}else{
						echo 	"<option value='block'>Block</option>";
						echo	"<option value='active'>Active</option>";
						}
						?>
						</select>
						</td>
					</tr>
					<tr>
						<td><input type="button" name="btn_submit" value="Cập nhật" class="btn_submit" onclick="updateProduct();" /></td>
						<td><a href="list_product.php"><input type="button" name="button" value="Quay lại" class="btn_submit"></a></td>
					</tr>
					</table>
				<div class="clear-both"></div>
				<div class="view-content">
				<div class="loading-container">
					<span class="loading-image" id="submit-loading"></span>
				</div>
				<div class="ajax-content" id="product-div">
					<?php //Product::printProductTable();?>
				</div>			
			</div>	
			</div>
			</div>
		</div>
	</div>
	</div>
	<div>
		<?php include '_footer_admin.php';?>
	</div>
</body>
</html>
				
				
